
//index.js实现
const app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    visible: true,
    canIUse: wx.canIUse('button.open-type.getUserInfo')
  },

  /**
   * 组件的方法列表
   */
  methods: {
    bindGetUserInfo: function (e) {
      this.triggerEvent('auth', e.detail)
      if (e.detail.errMsg.indexOf("ok") != -1) {
        this.setData({ visible: false });
      }
    }
  },

  /**
   * 组件渲染完，初始化授权检查
   */
  ready: function () {
    const that = this;
    wx.getSetting({
      success(res) {
        if (res.authSetting['scope.userInfo']) {
          that.setData({ visible: false });
          app.globalData.isok = true;
        }
      }
    })
  }
})

